from aiogram import F
from aiogram_dialog import Dialog, Window
from aiogram_dialog.widgets.kbd import Cancel, Start

from src.presentation.tg_bot.dialogs.getters.orders import user_subscription_getter
from src.presentation.tg_bot.dialogs.widgets import LocaleText
from src.presentation.tg_bot.states import (
    BuyProxySubscriptionSG,
    ManageProxySubscriptionSG,
    OrderDetailsSG,
    ProxySubscriptionSG,
)

subscription_info_window = Window(
    LocaleText("subscription-info"),
    Start(
        LocaleText("buy-subscription-btn"),
        id="buy_proxy_subscription",
        state=BuyProxySubscriptionSG.select_plan,
        when=~F["subscription_order"],
    ),
    Start(
        LocaleText("change-country-btn"),
        id="select_country_subscription",
        state=ManageProxySubscriptionSG.select_country,
        when=F["subscription_order"],
    ),
    Start(
        LocaleText("manage-subscription-btn"),
        id="manage_subscription_order",
        state=OrderDetailsSG.order_details,
        when=F["subscription_order"],
    ),
    Cancel(LocaleText("back-btn")),
    getter=user_subscription_getter,
    state=ProxySubscriptionSG.show_info,
)

subscription_info_dialog = Dialog(subscription_info_window)
